{% extends 'base.html' %}

{% block app_content %}
    <table class="table table-hover">
        <tr>
            <td width="256px"><img src="{{ get_avatars(user.email, 128) }}"></td>
            <td>
                <h1>{{ _('用户') }}：{{ user.username }}</h1>
                {% if user.about_me %}
                    <p>{{ user.about_me }}</p>
                {% endif %}
                {% if user.last_seen %}
                    {{ _('最后访问于') }}：<p>{{ moment(user.last_seen).format('LLL') }}</p>
                {% endif %}
                <p>
                    {{ _('粉丝') }} {{ user.followers.count() }}，{{ _('关注') }} {{ user.followed.count() }}
                </p>
                {% if user == current_user %}
                    <p><a href="{{ url_for('main.user_info_edit') }}">{{ _('编辑您的资料') }}</a></p>
                    {% if not current_user.get_task_in_progress('export_posts') %}
                        <p>
                            <a href="{{ url_for('main.export_posts') }}">{{ _('导出您的帖子') }}</a>
                        </p>
                    {% endif %}
                {% elif not current_user.is_following(user) %}
                    <p><a href="{{ url_for('main.follow', username=user.username) }}">{{ _('关注') }}</a></p>
                {% else %}
                    <p><a href="{{ url_for('main.unfollow', username=user.username) }}">{{ _('取消关注') }}</a></p>
                {% endif %}
                {% if user != current_user %}
                    <p><a href="{{ url_for('main.send_message', recipient=user.username) }}">{{ _('发送私信') }}</a></p>
                {% endif %}
            </td>
        </tr>
    </table>
    <br>
    {% for post in posts %}
        {% include '_post.html' %}
    {% endfor %}
    <br>
    <nav aria-label="...">
        <ul class="pager">
            <li class="previous{% if not prev_url %} disabled {% endif %}">
                <a href="{{ prev_url or '#' }}">
                    <span aria-hidden="true">&larr;</span> {{ _('上一页') }}
                </a>
            </li>
            <li>{{ _('第%(page)s页', page=page) }}</li>
            <li class="next{% if not next_url %} disabled {% endif %}">
                <a href="{{ next_url or '#' }}">
                     {{ _('下一页') }} <span aria-hidden="true">&rarr;</span>
                </a>
            </li>
        </ul>
    </nav>
{% endblock %}
